using System;

namespace Framework
{
    ///<summary>
    ///</summary>
    [AttributeUsage(AttributeTargets.Class)]
    public sealed class NamespaceExtensionAttribute : Attribute
    {
        ///<summary>
        ///</summary>
        ///<param name="type"></param>
        ///<returns></returns>
        public static NamespaceExtensionAttribute Get(Type type)
        {
            return (NamespaceExtensionAttribute)GetCustomAttribute(type, typeof (NamespaceExtensionAttribute));
        }

        ///<summary>
        ///</summary>
        ///<param name="type"></param>
        ///<returns></returns>
        public static bool IsDefined(Type type)
        {
            return Get(type) != null;
        }

        private readonly FolderAttributes _attributes;
        private readonly string _name;
        private readonly Targets _target;

        ///<summary>
        ///</summary>
        ///<param name="target"></param>
        ///<param name="name"></param>
        ///<param name="attributes"></param>
        ///<exception cref="ArgumentNullException"></exception>
        public NamespaceExtensionAttribute(Targets target, string name, FolderAttributes attributes)
        {
            this.IconIndex = -1;
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this._target = target;
            this._name = name;
            this._attributes = attributes;
        }

        ///<summary>
        ///</summary>
        public FolderAttributes Attributes
        {
            get { return _attributes; }
        }

        ///<summary>
        ///</summary>
        public bool CurrentUser { get; set; }

        ///<summary>
        ///</summary>
        public int IconIndex { get; set; }

        ///<summary>
        ///</summary>
        public string IconString { get; set; }

        ///<summary>
        ///</summary>
        public string InfoTip { get; set; }

        ///<summary>
        ///</summary>
        public string Name
        {
            get { return _name; }
        }

        ///<summary>
        ///</summary>
        public Targets Target
        {
            get { return _target; }
        }
    } ;
}
